AWS Lambda can be directly triggered by Amazon DynamoDB Streams to respond to changes in a DynamoDB table. When an item in the table is created, updated, or deleted, DynamoDB Streams captures these changes as stream records. Lambda functions can be configured to process these records in near real-time, enabling event-driven workflows such as auditing, data replication, notifications, or analytics.
Enable DynamoDB Streams on the target table with desired stream view type (e.g., NEW_IMAGE, OLD_IMAGE).
Create a Lambda function and set DynamoDB Stream as the event source.
Lambda automatically polls the stream and processes new records.
Records are provided as an array to the Lambda handler in the event object.
You can control batch size, starting position (LATEST or TRIM_HORIZON), and retry behavior.
Audit logging for table changes.
Triggering notifications or workflows when data changes.
Real-time analytics and monitoring.
Syncing changes with another data store or cache (e.g., Elasticsearch, Redis).